{% extends "./base.html" %}
{% block title %}
<title>快约面试</title>
{% endblock %}
{% block style %}
<link rel="stylesheet" href="/css/home.css">
{% endblock %}
{% block content %}
<div class="wrap job_bg">
  <div class="head">
    <div class="title">{{info.name}}</div>
    <div class="des">热招岗位·免费在线AI面试分析</div>
  </div>
  <div class="infoItem">
    <div class="title">
      <img src="/images/ic—3@2x.png" alt="">
    </div>
    <div class="tags num">
      {{info.money_start}}-{{info.money_end}}元
    </div>
  </div>
  <div class="infoItem">
    <div class="title">
      <img src="/images/ic—5@2x.png" alt="">
    </div>
    <div class="tags">
      {% if info.company_num %}
      {{info.company_num}}家招聘企业、
      {% endif %}
      {% if info.need %}
      岗位空缺{{info.need}}人
      {% endif %}
    </div>
  </div>
  {% if info.citys %}
  <div class="infoItem">
    <div class="title">
      <img src="/images/ic—4@2x.png" alt="">
    </div>
    <div class="tags">
      {%for val in info.citys %}{{val.city}}{% if loop.index != info.citys.length %}、{% endif %}{% endfor %}
    </div>
  </div>
  {% endif %}
  <!-- <div class="detail">
    <div class="title">
      职位描述
    </div>
    <div class="content" id="content"></div>
  </div> -->
</div>
<div class="bottom">
  <div class="title">免费AI面试</div>
  <div class="des">点击预约AI面试，完成面试后可获得面试分析报告助力您的求职</div>
  <span class="label">您的电话</span>
  <input type="text" placeholder="输入手机号" id="phoneNumber" maxlength="11">
  <div class="btn" onClick="enterPlugin({{openlink}})">
    开始面试
  </div>
</div>
<script>
  window.onload = function () {
    // document.getElementById('phoneNumber').innerHTML = decodeURI('{{info.desc}}')

  }

  function enterPlugin() {
    const val = document.getElementById('phoneNumber').value
    if (!val) {
      alert('请输入合法的手机号')
      return
    }
    var isPhone = /^0\d{2,3}-?\d{7,8}$/
    if (val.length !== 11 || isPhone.test(val)) {
      alert('请输入合法的手机号')
      return
    }

    $.get("/index/job/submit", {
      phone: val,
      id: '{{id}}'
    }, function (result) {
      if (result.data.openlink) {
        location.href = result.data.openlink
      } else {
        alert('请联系管理员')
      }
    });

    // if (!TICKET) {
    //   alert('请联系管理员')
    //   return
    // }

  }
</script>

{% endblock %}